﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ArbabTravelsERP.DAL;
using System.Data;

namespace ArbabTravelsERP.Models
{
    public class SearchModel
    {
        public string ANY { get; set; }
        public string ALL { get; set; }
        public string EXCLUDING { get; set; }
        public string RESUME_FORMAT { get; set; }
        public string EDUCATION_TYPE_ID { get; set; }
        public string SPECIALIZATION_TYPE_ID { get; set; }
        public string MUL_EDUCATION_TYPE_ID { get; set; }
        public string MUL_SPECIALIZATION_TYPE_ID { get; set; }
        public string MIN_YEAR_OF_PASSING_EDU { get; set; }
        public string MAX_YEAR_OF_PASSING_EDU { get; set; }

        public string STATE_CODE { get; set; }
        public string CITY_CODE { get; set; }
        public string MUL_STATE_CODE { get; set; }
        public string MUL_CITY_CODE { get; set; }
        public string INDUSTRY_ID { get; set; }
        public string DESIGNATION_ID { get; set; }
        public string MUL_INDUSTRY_ID { get; set; }
        public string MUL_DESIGNATION_ID { get; set; }
        public string MIN_YEAR_OF_PASSING_EXP { get; set; }
        public string MAX_YEAR_OF_PASSING_EXP { get; set; }
        public string MIN_AGE { get; set; }
        public string MAX_AGE { get; set; }
        public string LANGUAGE_ID { get; set; }
        public string MUL_LANGUAGE_ID { get; set; }
        public bool RESUME_NOT_VIEWED { get; set; }

        public List<SearchGridModel> SearchGridDetails { get; set; }

        public static List<SearchGridModel> GetSearchGridDetails(SearchModel search)
        {
            SearchDAL dal = new SearchDAL();
            DataTable dt = dal.SearchCandidateDetails(search);

            List<SearchGridModel> items = dt.AsEnumerable().Select(row => new SearchGridModel
            {
                REGISTRATION_NO = Convert.ToString(row.Field<string>("REGISTRATION_NO")),
                USER_IMAGE_PATH = Convert.ToString(row.Field<string>("USER_IMAGE_PATH")),
                //USER_IMAGE_PATH = Convert.ToString("~\\UserImage_UploadedFiles\\CD20150917095923_CD20150917095923_Penguins.jpg"),
                CANDIDATE_NAME = Convert.ToString(row.Field<string>("CANDIDATE_NAME")),
                GENDER_NAME = Convert.ToString(row.Field<string>("GENDER_NAME")),
                TOTAL_WORK_EXPERIENCE = Convert.ToString(row.Field<string>("TOTAL_WORK_EXPERIENCE")),
                SOURCE_NAME = Convert.ToString(row.Field<string>("SOURCE_NAME")),
                CURRENT_LOCATION = Convert.ToString(row.Field<string>("CURRENT_LOCATION")),
                INDUSTRY = Convert.ToString(row.Field<string>("INDUSTRY_TYPE")),
                VIEWED_BY = Convert.ToString(row.Field<string>("VIEWED_BY")),
                VIEWED = Convert.ToString(row.Field<int>("VIEWED")),
                DESIGNATION = Convert.ToString(row.Field<string>("DESIGNATION")),
                USER_EMAIL = Convert.ToString(row.Field<string>("USER_EMAIL")),
                CONTACT_NO = Convert.ToString(row.Field<string>("CONTACT_NO")),
                HIGHEST_EDUCATION = Convert.ToString(row.Field<string>("HIGHEST_EDUCATION")),
                
            }).ToList();
            return items;
        }
    }

    public class SearchGridModel : GridBaseModel
    {

    }
}